package com.sesamtv.decoder
{
	import flash.display.BitmapData;
	import flash.events.EventDispatcher;
	import flash.events.IEventDispatcher;
	import flash.events.StatusEvent;
	import flash.external.ExtensionContext;
	
	public class VideoDecoder extends EventDispatcher
	{
		private var _context:ExtensionContext;
		
		public function VideoDecoder()
		{
			_context = ExtensionContext.createExtensionContext('com.sesamtv.decoder.VideoDecoder', '');
			_context.addEventListener(StatusEvent.STATUS, onExtensionContextStatus);
		}
		
		public function get context():ExtensionContext
		{
			return _context;
		}
		
		public function PreloadFile( pFilename:String ):String
		{
			return _context.call( "PreloadFile", pFilename ) as String;
		}
		
		public function Decode(bitmap:BitmapData, frame:Number):void
		{
			_context.call( "Decode", bitmap, frame );
		}
		
		public function onExtensionContextStatus(e:StatusEvent):void
		{
			super.dispatchEvent(e);
		}
		
		
	}
}